package ms.maplestory.boot.repository;

import ms.maplestory.boot.client.character.Char;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface CharRepository extends JpaRepository<Char, Integer> {

    @Query(value = "FROM Char chr WHERE chr.stat.name = :name AND chr.stat.worldId = :wordId")
    Char existsByNameAndWorld(@Param("name") String name, @Param("wordId") Integer wordId);

    @Query(value = "FROM Char chr WHERE chr.stat.name = :name")
    Char findByName(@Param("name") String name);

}